<form id="add-form" class="form-horizontal" style="position:relative;background: #fff" role="form"
      data-toggle="validator" method="POST" action="">
    <script type="text/javascript"
            src="https://api.map.baidu.com/api?v=3.0&ak=HX3XrjGHigjidfWYSf6bozZbiABeWfUX"></script>
    <!--script type="text/javascript" src="/assets/js/backend/common/api?v=3.0&ak=HX3XrjGHigjidfWYSf6bozZbiABeWfUX"></script-->
    <script type="text/javascript" src="/assets/js/backend/common/DrawingManager_min.js"></script>
    <link rel="stylesheet" href="/assets/js/backend/common/flatpickr.min.css">
    <script src="/assets/js/backend/common/flatpickr.js"></script>
    <script src="/assets/js/backend/common/zh.js"></script>

    <style>
        #map {
            width: 100%;
            height: 500px;
        }

        .form-control {
            margin-bottom: 10px;
        }

        .button {
            margin-top: 10px;
            padding: 5px 10px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .coordinates {
            margin-top: 10px;
        }
    </style>
    <div class="panel">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#tabs_0" data-toggle="tab" aria-expanded="true">基础信息</a></li>
            <li><a href="#tabs_1" data-toggle="tab" id="classroomdiv" aria-expanded="true" style="display: none">教室作息设置</a></li>
        </ul>
    </div>
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade active in" id="tabs_0">
                <input type="hidden" name="row[id]" value="" class="form-control" data-rule="" data-tip="ID"/>

                <div class="form-group">
                    <label for="c-name" class="control-label col-xs-12 col-sm-2">教学点名称:</label>
                    <div class="col-xs-12 col-sm-8" id="div-name">
                        <input type="text" id="c-name" name="row[name]" value="" class="form-control" title="name"
                               placeholder="" data-rule="" data-tip="教学点名称"/>
                    </div>
                </div>
                {if $admin['group_id']==3}
                <input type="hidden" id="h-rel_type" name="row[rel_type]" value="1">
                <input type="hidden" id="h-rel_id" name="row[rel_id]" value="{$admin['school_id']}">

                {elseif $admin['group_id']==8}
                <input type="hidden" id="h-rel_type" name="row[rel_type]" value="2">
                <input type="hidden" id="h-rel_id" name="row[rel_id]" value="{$admin['community_id']}">
                {else}
                <div class="form-group">
                    <label for="c-rel_type" class="control-label col-xs-12 col-sm-2">主体类型:</label>
                    <div class="col-xs-12 col-sm-8" id="div-rel_type">
                        <select name="row[rel_type]" id="c-rel_type" class="form-control selectpicker" data-rule=""
                                data-tip="主体类型">
                            <option value="1">学校</option>
                            <option value="2">社区</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-rel_id" class="control-label col-xs-12 col-sm-2">主体:</label>
                    <div class="col-xs-12 col-sm-8" id="div-rel_id">
                        <select name="row[rel_id]" id="c-rel_id" class="form-control" data-tip="主体">
                        </select>
                    </div>
                </div>
                {/if}
                {if $admin['group_id']==3}
                <div class="form-group">
                    <label for="c-ocation_pid" class="control-label col-xs-12 col-sm-2">父级:</label>
                    <div class="col-xs-12 col-sm-8" id="div-pid">
                        <select name="row[pid]" id="c-ocation_pid" class="form-control" data-tip="父级教学点标签">
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-address_lv_octionlevel" class="control-label col-xs-12 col-sm-2">教学点等级:</label>
                    <div class="col-xs-12 col-sm-8" id="div-cation_level_type">
                        <select name="row[address_lv_octionlevel]" id="c-address_lv_octionlevel" class="form-control"
                                data-tip="教学点等级">
                            <option value="1">一级教学点</option>
                            <option value="2">二级教学点</option>
                            <option value="3">三级教学点</option>
                            <option value="4">上课教室</option>
                        </select>
                    </div>
                </div>
                {else}
                <input type="hidden" id="h-address_lv" name="row[address_lv]" value="0">
                {/if}
                {if $admin["group_id"]==1||$admin["group_id"]==2||$admin["group_id"]==3||$admin["group_id"]==8}
                <div class="form-group">
                    <label for="c-starttime" class="control-label col-xs-12 col-sm-2">使用期限开始:</label>
                    <div class="col-xs-12 col-sm-8" id="div-starttime">
                        <div class="form-inline">
                            <input type="text" id="c-starttime" name="row[starttime]"
                                   value="<?php echo date('Y-m-d');?>" class="form-control datetimepicker"
                                   data-date-format="YYYY-MM-DD" data-tip="使用期限开始" data-rule=""/>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-endtime" class="control-label col-xs-12 col-sm-2">使用期限结束:</label>
                    <div class="col-xs-12 col-sm-8" id="div-endtime">
                        <div class="form-inline">
                            <input type="text" id="c-endtime" name="row[endtime]" value="<?php echo date('Y-m-d');?>"
                                   class="form-control datetimepicker" data-date-format="YYYY-MM-DD"
                                   data-tip="使用期限结束" data-rule=""/>
                        </div>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">实体或虚拟:</label>
                    <div class="col-xs-12 col-sm-8" id="div-entvirt">
                        <label for="row[entvirt]-1"><input id="row[entvirt]-1" name="row[entvirt]" type="radio"
                                                           value="1" data-tip="实体或虚拟" checked/> 实体</label>
                        <label for="row[entvirt]-2"><input id="row[entvirt]-2" name="row[entvirt]" type="radio"
                                                           value="2" data-tip="实体或虚拟"/> 虚拟</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">教学类型:</label>
                    <div class="col-xs-12 col-sm-8" id="div-ocation_type">
                        <label for="row[ocation_type]-1"><input id="row[ocation_type]-1" name="row[ocation_type]"
                                                                type="radio" value="1"/> 标准(有桌椅)</label>
                        <label for="row[ocation_type]-2"><input id="row[ocation_type]-2" name="row[ocation_type]"
                                                                type="radio" value="2"/> 书画(有书画桌)</label>
                        <label for="row[ocation_type]-3"><input id="row[ocation_type]-3" name="row[ocation_type]"
                                                                type="radio" value="3"/> 肢体(开阔的场地)</label>
                        <label for="row[ocation_type]-4"><input id="row[ocation_type]-4" name="row[ocation_type]"
                                                                type="radio" value="4"/> 综合(有椅没桌)</label>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-cityarea_id" class="control-label col-xs-12 col-sm-2">行政区划:</label>
                    <div class="col-xs-12 col-sm-8" id="div-cityarea_id">
                        <div style="margin-top:-2px;margin-left: -2px;">
                            <select id="c-cityarea_id" id="province" class="form-control liandong"
                                    name="row[province_id]"
                                    type="text" value="">

                            </select>
                            <select id="city" class="form-control liandong" name="row[city_id]"
                                    type="text" value="">

                            </select>
                            <select id="county" class="form-control liandong" name="row[district_id]"
                                    type="text" value="">

                            </select>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label for="c-longitude" class="control-label col-xs-12 col-sm-2">经纬度定位:</label>
                    <div class="col-xs-12 col-sm-8" id="div-longitude">
                        <div id="map" style="width: 100%; height: 300px;"></div>
                        经度：<input type="text" id="c-longitude" name="row[longitude]" value="" class="form-control"
                                    placeholder="经度" data-rule=""/>
                        纬度：<input type="text" id="c-latitude" name="row[latitude]" value="" class="form-control"
                                    placeholder="纬度" data-rule=""/>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-address" class="control-label col-xs-12 col-sm-2">描述:</label>
                    <div class="col-xs-12 col-sm-8" id="div-address">
                        <input type="text" id="c-address" name="row[address]" value="" class="form-control"
                               title="address" placeholder="" data-rule="" data-tip="地址"/>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-intro" class="control-label col-xs-12 col-sm-2">教学点详情:</label>
                    <div class="col-xs-12 col-sm-8" id="div-intro">
                        <textarea name="row[intro]" id="c-intro" class="form-control editor" data-rule="" rows="5"
                                  data-tip="学校简介"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label for="c-status" class="control-label col-xs-12 col-sm-2">状态:</label>
                    <div class="col-xs-12 col-sm-8" id="div-status">
                        <input id="c-status" name="row[status]" type="hidden" value="1">
                        <a href="javascript:" data-toggle="switcher" class="btn-switcher" data-input-id="c-status"
                           data-yes="1" data-no="0">
                            <i class="fa fa-toggle-on text-success fa-flip-horizontal fa-2x"></i>
                        </a>
                        <div data-favisible="switch=1" class="p-3">已开户</div>
                    </div>
                </div>
            </div>
            <div class="tab-pane fade in" id="tabs_1">
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">时段选择:</label>
                    <div class="col-xs-12 col-sm-8" id="div-daytime">
                        <label for="row[daytime]-1"><input id="row[daytime]-1" name="row[daytime][]" type="checkbox"
                                                           value="1" checked/> 上午</label>
                        <label for="row[daytime]-2"><input id="row[daytime]-2" name="row[daytime][]" type="checkbox"
                                                           value="2"/> 中午</label>
                        <label for="row[daytime]-3"><input id="row[daytime]-3" name="row[daytime][]" type="checkbox"
                                                           value="3" checked/> 下午</label>
                        <label for="row[daytime]-4"><input id="row[daytime]-4" name="row[daytime][]" type="checkbox"
                                                           value="4"/> 晚上</label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">课节时长:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="text" id="c-classtime" name="row[classtime]" value="90" class="form-control"
                               title="classtime" placeholder="请输入一堂课的时间" data-rule="" data-tip="一堂课的时间"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">课间休息时间:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="text" id="c-classsleeptime" name="row[classsleeptime]" value="15"
                               class="form-control" title="classsleeptime" placeholder="请输入课间的休息时间"
                               data-rule="" data-tip="请输入课间的休息时间"/>
                    </div>
                </div>


                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">排时段:</label>
                    <div class="col-xs-12 col-sm-8">
                        <div id="schedule-table-container" style="margin-top: 20px;">
                            <!-- 表格将动态生成在这里 -->
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">周最大课数<br>(最大：<span id="maxks"></span>):</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="number" id="c-classes-per-week" name="row[classes_per_week]" value="20"
                               class="form-control" title="classes_per_week" placeholder="请输入一周的最大排课数"
                               data-rule="" data-tip="一周最大排课数"/>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">周几上课:</label>
                    <div class="col-xs-12 col-sm-8">
                        <label for="weekdays-1"><input id="weekdays-1" name="row[weekdays][]" type="checkbox" value="1"/> 周一</label>
                        <label for="weekdays-2"><input id="weekdays-2" name="row[weekdays][]" type="checkbox" value="2"/> 周二</label>
                        <label for="weekdays-3"><input id="weekdays-3" name="row[weekdays][]" type="checkbox" value="3"/> 周三</label>
                        <label for="weekdays-4"><input id="weekdays-4" name="row[weekdays][]" type="checkbox" value="4"/> 周四</label>
                        <label for="weekdays-5"><input id="weekdays-5" name="row[weekdays][]" type="checkbox" value="5"/> 周五</label>
                        <label for="weekdays-6"><input id="weekdays-6" name="row[weekdays][]" type="checkbox" value="6"/> 周六</label>
                        <label for="weekdays-7"><input id="weekdays-7" name="row[weekdays][]" type="checkbox" value="7"/> 周日</label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">禁用周段:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select type="text" id="DisableWeekRange" name="row[disable_week_range][]" multiple class="form-control selects" placeholder="点击选择日期" data-rule="" data-tip="哪天禁排课"></select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">禁用时点:</label>
                    <div class="col-xs-12 col-sm-8">
                        <select type="text" id="DisableWeekTime" name="row[disable_week_time][]" multiple class="form-control selects" placeholder="点击选择日期" data-rule="" data-tip="哪天禁排课"></select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="control-label col-xs-12 col-sm-2">容纳人数:</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="number" id="maxnumber" name="row[max_number]" multiple value="" class="form-control" placeholder="单教室每周最大排课数量" data-rule="" data-tip="单教室每周最大排课数量"></input>
                    </div>
                </div>
                <div class="form-group layer-footer">
                    <label class="control-label col-xs-12 col-sm-2"></label>
                    <div class="col-xs-12 col-sm-8">
                        <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
                        <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>



